import React,{Component} from 'react';
import fetch from 'isomorphic-fetch';
import './../../css/reset.css';
import './../../css/main.css';
import './shop.css';
import $ from 'jquery';
import Blank from './../../components/blank/blank';
import Album2 from './../../components/album/album2';
import Buy from './../../components/buy/buy';
import Keywords from './../../components/keywords/keywords';
import Stars from './../../components/stars/stars';
import Keywords2 from './../../components/keywords/keywords2';
import BusinessMsg from './../../components/businessMsg/businessMsg';
import Know from './../../components/know/know';
import Card from './../../components/card/card';
class Clumn extends Component{
  constructor(props){
    super(props);
    this.state={};
  }
  getUrlParam(name){
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    let hrefSeach='';
    if(window.location.href.indexOf('?')>0){
      hrefSeach = window.location.href.split('?')[1];
    }else{
      return;
    }
    let rl = hrefSeach.match(reg);
    if (rl != null) return decodeURI(rl[2]); return null;
  }
  //组件初始化时不调用，组件接受新的props时调用。
  componentWillReceivePorps(nextProps){

  }
  //组件接受新的state或者props时调用,对比前后两个props和state是否相同，如果相同则返回false阻止更新;
  //调用this.forceUpdate会跳过此步骤。
  shouldComponentUpdate(nextProps, nextState){

  }
  //组件初始化时不调用，只有在组件将要更新时才调用，此时可以修改state
  componentWillUpdata(nextProps, nextState){

  }
  componentDidMount(){
    fetch('this.props.url')
      .then(response=>response.json())
      .then(json=>{
        this.setState(json);
      })
      .catch((error) => {  
        console.error(error);  
      });  
  }
  //组件初始化时不调用，组件更新完成后调用，此时可以获取dom节点。
  componentDidUpdate(){

  }
  //组件将要卸载时调用，一些事件监听和定时器需要在此时清除。
  componentWillUnmount(){

  }
  render(){
  	return(
  		<div className='shop_view'>
        <Album2 />
  		  <div className='shop_atOnce' style={{background:'#ffffff'}}>
          <Buy />
          <Keywords />
          <Blank />
          <Stars />
          <Keywords2 />
          <Blank />
          <BusinessMsg />
          <Blank />
          <Know />
          <Blank />
          <div className='shop_list'>
            <div className='shop_adverse border_bottom'><span>{'看了本团购的用户还看了'}</span><span>{'广告'}</span></div>
            <ul className='list'>
              <Card link={'./shop'} />
              <Card link={'./shop'} />
              <Card link={'./shop'} />
              <Card link={'./shop'} />
              <Card link={'./shop'} />
            </ul>
          </div>
        </div>
  		</div>
  		)
  }
}
export default Clumn;